#!/bin/bash

if [[ $(id -u) != 0 ]]; then
    echo "Please run as root or use sudo"
    exit 1
fi

set -e

# Debian 12
# apt-get install -y libtraceevent-dev
PKGS="${PKGS} psmisc procps"
PKGS="${PKGS} sysbench"
PKGS="${PKGS} gdb"
PKGS="${PKGS} linux-perf"
PKGS="${PKGS} strace uftrace trace-cmd bpftrace"
# for uftrace dump --graphviz
PKGS="${PKGS} graphviz"

SUCCESSED=""
FAILED=""

for pkg in ${PKGS}; do
    echo "Installing ${pkg}"
    apt-get install -y ${pkg} \
        && SUCCESSED="${SUCCESSED} ${pkg}" \
        || FAILED="${FAILED} ${pkg}"
done

echo "SUCCESSED: " ${SUCCESSED}
echo "FAILED: " ${FAILED}
